#include<stdio.h>
#include<sys/types.h>
#include<unistd.h>

int main(int argc, char const *argv[])
{   
    printf("我是%d进程",getpid());
    pid_t pid = fork();
    if (pid==-1)    
    {   
        printf("创建子进程失败");   
    }else if (pid==0) printf("我是%d进程的子进程%d",getpid(),getppid());
    else printf("我是%d进程的父进程%d",pid,getpid());
    
    
    return 0;
}
